/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.K330;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class K330Store extends K330{
    

    public List<K330> getListK350All(int pnFH000, int pnFH200,String pvKV333, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_K330N, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                         new Param(OracleTypes.CHAR, pvKV333),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, K330.class);
        } catch (SQLException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }


    public int updateK350(int pnPK350,
            String pnKV351, String pnKV352,String pvKV333,
            int pnFH000, int pnFH200, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_K330N, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPK350),
                    new Param(OracleTypes.CHAR, pnKV351),
                    new Param(OracleTypes.CHAR, pnKV352),
                     new Param(OracleTypes.CHAR, pvKV333),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, K330.class);
        } catch (SQLException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    public int deleteK330(int pnPK350, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_K330, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPK350),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, K330.class);
        } catch (SQLException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }

   public List<K330> findAllK350ForCombo(int pnFH000, int pnFH200, int pnPK350,String pvKV333, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMBO_K330N, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnPK350),
                         new Param(OracleTypes.CHAR, pvKV333),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, K330.class);
        } catch (SQLException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
